unit ICQ_RemoteCP_Language;

interface

uses
 Classes;

const
 cLangBot = 'BotLanguage';
 cLangMode = 'LanguageMode';
 cLangDM = 0;
 cLangSelect = 1;
 cLangSettings = 'SettingsLanguage';

{removed in 2.5.2
var
 LangsList: TStrings = nil;

function IndexOfValue(const Value: String; List: TStrings): Integer;
procedure BuildLangList(List: TStrings);
procedure GetLangNamesList(LangList, LangNamesList: TStrings);
}
implementation
(* removed in 2.5.2
uses
 SysUtils,
 ICQ_RemoteCP_Settings,
 gnugettext,
 languagecodes;

const
 LocaleFolder = 'locale\';

 {Common stuff}

function IndexOfValue(const Value: String; List: TStrings): Integer;
 var
  i: Integer;
begin
 if Assigned(List) then
  begin
   i:=List.Count-1;
   repeat
    Result:=i;
    Dec(i);
   until (Result<0) or (List.ValueFromIndex[Result]=Value);
  end
 else
   Result:=-2;
end;

procedure BuildLangList(List: TStrings);
 var
  sr: TSearchRec;
  i: Integer;
  Path, s: String;
begin
 if Assigned(List) then
  begin
   List.Clear;
   //first is always built-in English
   List.Add('en=English (built in)');
   //
   Path:=IncludeTrailingPathDelimiter(PluginPath+LocaleFolder);
   if DirectoryExists(Path) then
    begin
     i:=FindFirst(Path+'*.*', faDirectory, sr);
     while i=0 do
      begin
       s:=getlanguagename(sr.Name);
       {changed in 2.5.1
       if s='' then
        begin
         if sr.Name='tx' then //artificial code
           List.Add('tx=Translit');
        end
       else
         List.Add(sr.Name+'='+s);
       }
       //translit known as Volapuk
       if s<>'' then
         List.Add(sr.Name+'='+s);
       i:=FindNext(sr);
      end;
     FindClose(sr);
    end;
  end;
end;

procedure GetLangNamesList(LangList, LangNamesList: TStrings);
 var
  i: Integer;
begin
 if Assigned(LangList) then
  begin
   if Assigned(LangNamesList) then
    begin
     LangNamesList.Clear;
     for i:=0 to LangList.Count-1 do
       LangNamesList.Add(LangList.ValueFromIndex[i]);
    end;
  end
 else
  begin
   if Assigned(LangNamesList) then
     LangNamesList.Clear;
  end;
end;
*)
end.
 